package com.hbnu;


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class FileClient {
    public static void main(String[] args) {
        ServerSocket serverSocket=null;
        BufferedReader bufferedReader=null;
        Socket socket=null;
        PrintWriter printWriter=null;
        try {
            serverSocket =new ServerSocket(8080);
            System.out.println("服务端开启");
            socket=serverSocket.accept();
            System.out.println("客户端已连接");
            bufferedReader =new BufferedReader(new InputStreamReader(socket.getInputStream()));
            String msg= bufferedReader.readLine();
            System.out.println("收到客户端消息："+msg);
            printWriter=new PrintWriter(socket.getOutputStream(),true);
        }
        catch (Exception e){
            throw new RuntimeException(e);
        }
    }
}
